package com.bwie.goods.controller;

import com.bwie.common.domain.PowerStation;
import com.bwie.common.domain.request.PowerStationRequest;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.goods.service.PowerStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/PowerStation")
public class PowerStationController {
    @Autowired
    PowerStationService powerStationService;

    /**
     * 电站列表
     * @return
     */
    @PostMapping("/list")
    public Result<PageResult<PowerStation>> list(@RequestBody PowerStationRequest powerStationRequest){
        Result<PageResult<PowerStation>> list=powerStationService.list(powerStationRequest);
        return list;
    }

    /**
     * 上传图片
     * @param file
     * @return
     */
    @PostMapping("/loads")
    public Result loads(@RequestParam("file")MultipartFile file){
        Result result=powerStationService.loads(file);
        return result;
    }
}
